import torch
import torch.nn as nn
import torchvision.models as models


class ResNet50(nn.Module):
    def __init__(self, ResNetmode=152, num_classes=8, pre=True):
        super(ResNet50, self).__init__()

        if ResNetmode == 50:
            self.resnet = models.resnet50(pretrained=pre)
        elif ResNetmode == 101:
            self.resnet = models.resnet101(pretrained=pre)
        elif ResNetmode == 152:
            self.resnet = models.resnet152(pretrained=pre)

        num_ftrs = self.resnet.fc.in_features
        self.resnet.fc = nn.Linear(num_ftrs, num_classes)

    def forward(self, x):
        x = self.resnet(x)
        return x
